package com.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 401. 二进制手表
 * 枚举时分
 *
 * @author fy
 * @date 2022/5/5 9:06
 */
public class Solution401_1 {

    public List<String> readBinaryWatch(int turnedOn) {
        List<String> res = new ArrayList<>();
        for (int h = 0; h < 12; h++) {
            for (int m = 0; m < 60; m++) {
                if (Integer.bitCount(h) + Integer.bitCount(m) == turnedOn) {
                    res.add(h + ":" + (m < 10 ? "0" + m : m));
                }
            }
        }
        return res;
    }

}
